clear all;
clc;

% This file is dedicated to let us run all the same compression parameters
% and store it in the same data structure.

% Note that in this version, jpxr is not included, because I'm sitting at a
% Linux PC at the moment, I'll add later.

% Please test and give feedback today, I'll complete tomorrow and refine
% the step sizes a bit ... This is then going to be a very long run, It
% runs for almost 3min now for only 5 images ^^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 CONFIGURATION
raw = '/home/tbergmueller/dev/mm/databases/iitd/'; % Where do I get the raw data from? (i.e. image database)
baseFolder = '/home/tbergmueller/dev/mm/databases_compressed/iitd/';  % Where do you want to get your results?
extension = 'bmp'; % Which extension (without dot) do the images in the database have?






%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DO NOT CHANGE BELOW THIS LINE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 

% Test setup
minQuality = 70;
maxQuality = 100;
stepQuality = 15;

crMin = 10;
crStep = 20;
crMax = 50;

methods = ['jpg'; 'jp2'];
%methods = ['jxr'];

crs = crMin:crStep:crMax;
qualities = minQuality:stepQuality:maxQuality;


for i=1:size(methods,1)
    
    method = methods(i,:);
    
    for j=1:size(qualities,2)
        quality = qualities(j);    
        
        for k=1:size(crs,2)
            cr = crs(1,k);

            % method = 'jpg';     % Specify jp2, jxr, jpg (i guess)
            % cr = 30;            % Compression ratio
            % quality = 75;       % quality of the first compression step in double compression

            % don't change below this line...
            single = [baseFolder 'method_' method '/single/' 'cr' num2str(cr) '/'];
            double = [baseFolder 'method_' method '/double/' 'cr' num2str(cr) '/quality' num2str(quality) '/' ];
            q75 = [baseFolder 'tmp/'];


            final_compression_test(raw, q75, single, double, cr, method, quality, extension);
        end
    end
end